#include "Comm.hpp"
#include "Shm.hpp"
#include "Fifo.hpp"

int main()
{
    Shm shm(pathname, projid, CREATER);
    // shm.Attr();
    // shm.VirtualAddr();

    NamedFifo nf(PATH, NAME);
    FileOperation fo(PATH, NAME);
    fo.OpenForRead();

    // 使用命名管道的方式，让数据的读取按照特定的格式读取
    char *mem = (char *)shm.VirtualAddr();
    while (true)
    {
        if (fo.Wait())
        {
            printf("%s\n", mem);
        }
        else
        {
            break;
        }
    }

    fo.Close();
    return 0;
}